
def check_sks(a):
    stack = []
    sks = {')': '(', ']': '[', '}': '{'}

    for sk in a:
        if sk in sks.values():
            stack.append(sk)
        elif sk in sks:
            if not stack or sks[sk] != stack.pop():
                return False

    return not stack

a = input()
result = check_sks(a)

if result:
    print("True")
else:
    print("False")